<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->title;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>


<!--bi-->
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/bi.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/bi.js"></script>

</head>
<body style="overflow:auto;">
<div id="main" style="clear:both;">
		<div class="bi-body">
			<form id="searchForm" name="searchForm" method="post" action="<?php echo $this->projectUrl(array('action'=>'from-count'));?>" >
			<div class="bi-search  bi-search-2">
				<div class="bi-s-top"></div>
				<div class="bi-s-center">
					<div class="bi-s-c-con">
						<div class="bi-s-c-sel">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							  <tr>
							  	<td colspan="5">
									<!-- 时间选择条 -->
									<div id="timeRange">
										<a onclick="selData('<?php echo $this->projectUrl(array('action'=>'from-count')) ;?>',1,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==1 ? 'currentTimeRange' : ''?>">昨天</a> <a onclick="selData('<?php echo $this->projectUrl(array('action'=>'from-count')) ;?>',2,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==2 ? 'currentTimeRange' : ''?>">最近7天</a> <a onclick="selData('<?php echo $this->projectUrl(array('action'=>'from-count')) ;?>',3,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==3 ? 'currentTimeRange' : ''?>">最近30天</a> <a onclick="selData('<?php echo $this->projectUrl(array('action'=>'from-count')) ;?>',4,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==4 ? 'currentTimeRange' : ''?>">最近三个月</a> <a onclick="selData('<?php echo $this->projectUrl(array('action'=>'from-count')) ;?>',5,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==5 ? 'currentTimeRange' : ''?>">全部</a>&nbsp;&nbsp;&nbsp;&nbsp;
										<span>日期选择</span>：<input name="startTime" type="text" class="input" id="startTime" size="18" value="<?php echo $this->vars['startTime'];?>" /><script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":true,"showOthers":false,"timeFormat":24,"inputField":"startTime","button":"startTime"});</script>
						-
						<input name="endTime" type="text" class="input" id="endTime" size="18" value="<?php echo $this->vars['endTime'];?>" />
						<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":true,"showOthers":false,"timeFormat":24,"inputField":"endTime","button":"endTime"});</script>
									</div>
									<!-- 时间选择条 -->	
								</td>
								<td rowspan="3">
									<input type="hidden" name="dateType" id="dateType" value="<?php echo $this->vars['dateType'];?>" />
									<input type="hidden" name="doType" id="doType" value="<?php echo $this->vars['doType'];?>" />	
									<input name="search" type="button" id="search" value="" class="s-button" onclick="selData('<?php echo $this->projectUrl(array('action'=>'from-count')) ;?>',6,<?php echo $this->vars['doType'];?>);"/>								
								</td>
							  </tr>
							  <tr>
								<td colspan="5">地区选择：
									<select name="areas" id="areas" >
									  <option value="">全部</option>
									</select></td>
								</tr>
							  <tr>
								  <td>操作系统：
										<select name="osName" id="osName" size="1">
											<option value="">全部</option>
											<?php foreach($this->osNameRows as $key=>$row) {?>
											<option value="<?php echo $row[0];?>" <?php if($this->vars['osName']==$row[0]){?>selected="selected"<?php }?>><?php echo $row[1];?></option>
											<?php }?>
										</select></td>		
									<td >渠道：</td>
									<td ><div style="position: relative; width:130px;">
										<select  name="select" id="select" class="select-write" onchange="source.value=select.value;source.select()">
											<option value="">==选择==</option>   
											<?php foreach($this->memberRows as $key=>$row) {
												if (trim($row['name'])!=''){
											?>
											  <option value="<?php echo $row['name'];?>" <?php if($this->vars['source']==$row['name']){?>selected="selected"<?php }?>><?php echo $row['name'];?></option>   
											<?php }
												}
											?>
										  </select>   
  							 			 <input type="text" class="text-write" name="source" id="source" value="<?php echo $this->vars['source'];?>"/>
										</div>
									</td>
									<td >SourceId ：</td>
									<td><div style="position: relative; width:130px;" class="sourceId-con">
										<select name="select_sourceId" id="select_sourceId" class="select-write" onchange="sourceId.value=select_sourceId.value;sourceId.select()">
											<option value="">==选择==</option> 
										</select>
										<input type="text" class="text-write" name="sourceId" id="sourceId" value="<?php echo $this->vars['sourceId'];?>"/>
										<input type="hidden" name="default_sourceId" id="default_sourceId" value="<?php echo $this->vars['sourceId'];?>" />
										</div>
										<div class="sourceId-con-loading" style="width:130px;display:none;">加载中...</div>
									</td>
								  </tr>
								</table>
						</div>
									
						
						
					</div>	
				</div>
				<div class="bi-s-bottom"></div>			
			</div>
			</form>
			<div class="clear" style="height:20px;"></div>
			
			<div class="bi-data">
				<div class="bi-d-top">
					<div class="d-t-left">基础漏斗分析</div>
					<div class="d-t-right"><span <?php if(count($this->rows)>0){?>class="show"<?php } else {?>class="hide"<?php }?> id="data_02" onclick="showData('02')" style="cursor:pointer;"></span></div>
				</div>
				<div class="bi-d-center clear" id="data02">
					<div class="bi-d-center-bg">
					<!--content start-->
					<span class="d-line"></span>
					
					
<table width="580" border="0" cellspacing="0" cellpadding="0" style=" margin-left:60px;">
  <tr>
    <td colspan="5" height="20">&nbsp;</td>
    </tr>
  <tr>
    <td width="100">&nbsp;</td>
    <td width="100">&nbsp;</td>
    <td width="165">
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:150px;">首页</div>
			<div class="d-path-right"></div>
		</div>
	</td>
    <td width="100">&nbsp;</td>
    <td width="100">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>
		<div class="d-from-c-left"><?php echo $this->rows['1004-'.'1002']['pv']>0 ? 100 : 0;?>%</div>
		<div class="d-from-c-arrow"></div>
		<div class="d-from-c-right"><?php echo $this->rows['1004-'.'1002']['pv'];?></div>
	</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:80px;">其他页面</div>
			<div class="d-path-right"></div>
		</div>
	</td>
    <td><?php 
		 $other = $this->rows['1004-'.'1007']['pv']>0 ? number_format($this->rows['1004-1007-other']['pv']/$this->rows['1004-'.'1007']['pv'],4)*100 : 0;
		 $other = $other>100 ?100:$other;
		 ?>
		<div class="d-from-l-c">
		<span class="pre"><?php echo $other;?>%</span>
		<span class="num"><?php echo $this->rows['1004-1007-other']['pv'];?></span>
		</div>
	</td>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:150px;">商品详情</div>
			<div class="d-path-right"></div>
		</div>
	</td>
    <td>
		<?php 
		 $lostNum = $this->rows['1004-'.'1007']['pv'] - $this->rows['1004-1007-count']['pv'];
		 $lostNum = $lostNum>0 ? $lostNum:0;
		 $lost = $this->rows['1004-'.'1007']['pv']>0 ? number_format($lostNum/$this->rows['1004-'.'1007']['pv'],4)*100 : 0;
		 $lost = $lost>100 ? 100:$lost;
		 ?>
		<div class="d-from-r-c"><span class="pre"><?php echo $lost;?>%</span><span class="num"><?php echo $lostNum;?></span></div></td>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:80px;">LOST</div>
			<div class="d-path-right"></div>
		</div>
	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>
		<div class="d-from-c-left">&nbsp;</div>
		<div class="d-from-c-arrow"></div>
		<div class="d-from-c-right"><?php echo $this->rows['1004-'.'1007']['pv'];?></div>
	</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;
		
	</td>
    <td>&nbsp;</td>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:150px;">加入购物车</div>
			<div class="d-path-right"></div>
		</div>
	</td>
    <td>&nbsp;</td>
    <td>&nbsp;
		
	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>
		<div class="d-from-c-left"><?php echo $this->rows['1004-'.'1002']['pv']>0 ? number_format($this->rows['1005-'.'1003']['pv']/$this->rows['1004-'.'1002']['pv'],4)*100 : 0;?>%</div>
		<div class="d-from-c-arrow"></div>
		<div class="d-from-c-right"><?php echo $this->rows['1005-'.'1003']['pv'];?></div>
	</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:80px;">其他页面</div>
			<div class="d-path-right"></div>
		</div>
	</td>
    <td>
		<?php 
		 //算法：直接用来源为结算中心的count-订单
		 $otherNum = $this->rows['1004-1012-count']['pv'] - $this->rows['1005-'.'1007']['pv'];
		 $otherNum = $otherNum>0 ?$otherNum:0;
		 $other = $this->rows['1004-'.'1012']['pv']>0 ? number_format($otherNum/$this->rows['1004-'.'1012']['pv'],4)*100 : 0;
		 $other = $other>100 ?100:$other;
		 ?>
		<div class="d-from-l-c">
		<span class="pre"><?php echo $other;?>%</span>
		<span class="num"><?php echo $otherNum;?></span>
		</div>
	</td>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:150px;">结算中心</div>
			<div class="d-path-right"></div>
		</div>
	</td>
    <td><?php 
		 //算法：结算中心-订单-其它页
		 /*$lostNum = $this->rows['1004-'.'1012']['pv'] - $this->rows['1004-1012-count']['pv'];*/
		 $lostNum = $this->rows['1004-'.'1012']['pv'] - $otherNum - $this->rows['1005-'.'1007']['pv'];
		 $lostNum = $lostNum>0 ? $lostNum:0;
		 $lost = $this->rows['1004-'.'1012']['pv']>0 ? number_format($lostNum/$this->rows['1004-'.'1012']['pv'],4)*100 : 0;
		 $lost = $lost>100 ? 100:$lost;
		 ?>
		<div class="d-from-r-c"><span class="pre"><?php echo $lost;?>%</span><span class="num"><?php echo $lostNum;?></span></div></td>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:80px;">LOST</div>
			<div class="d-path-right"></div>
		</div>
	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>
		<div class="d-from-c-left"><?php echo $this->rows['1004-'.'1002']['pv']>0 ? number_format($this->rows['1004-'.'1012']['pv']/$this->rows['1004-'.'1002']['pv'],4)*100 : 0;?>%</div>
		<div class="d-from-c-arrow"></div>
		<div class="d-from-c-right"><?php echo $this->rows['1004-'.'1012']['pv'];?></div>
	</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>
		<div class="d-path">
			<div class="d-path-left"></div>
			<div class="d-path-center" style="width:150px;">订单</div>
			<div class="d-path-right"></div>
		</div>
	</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>
		<div class="d-from-c-left"><?php echo $this->rows['1004-'.'1002']['pv']>0 ? number_format($this->rows['1005-'.'1007']['pv']/$this->rows['1004-'.'1002']['pv'],4)*100 : 0;?>%</div>
		<div class="d-from-c-arrow" style="background:none; height:12px;"></div>
		<div class="d-from-c-right"><?php echo $this->rows['1005-'.'1007']['pv'];?></div>
	</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="5" height="20">&nbsp;</td>
    </tr>
</table>


					
					
					
					<table class="table" style="display:none;">
						<tr class="subject">
							<td>eventPageId</td>
							<td>pageId</td>
							<td>pv</td>
							<td>uv</td>
						</tr>
						<?php 
						foreach($this->rows as $var=>$row) {
						?>
							<tr class="dataLine">
								<td><?php echo $row['eventPageId'];?></td>
								<td><?php echo $row['pageId'];?></td>
								<td><?php echo $row['pv'];?></td>
								<td><?php echo $row['uv'];?></td>
							</tr>
						<?php
						}
						?>
				  	</table>
					<!--content end-->
					<div  class="d-note">说明：分析通过PV值计算得出.</div>
					
					</div>
				</div>
				<div class="bi-d-bottom"></div>
			</div>
						
			
			
		</div>
	
</div>
<script language="javascript">
function selData(action,dateType,doType){
    $('#searchForm').attr('action', action);
	$('#dateType').attr('value', dateType);
	$('#doType').attr('value', doType);
    $('#searchForm').submit();
}


<!-- 更新渠道时，更新sourceId start-->
$(function(){
	$("#select").change(function(){
	if($.trim($("#source").val())!=''){
		$(".sourceId-con").hide();
		$(".sourceId-con-loading").show();
		//$("#sourceId").attr('value','');
		var self=$("#select_sourceId")[0];
			 $.ajax({ url: "<?php echo $this->projectUrl(array('controller'=>'act-day-data-pagevisit','action'=>'sourceids'));?>",
				 type:"post",           
				 dataType:"json",
				 data: "source="+$("#source").val(),
				 success:function(data){ 
						self.options.length=0;
						self.options[0] = new Option('==选择==', '');
						var default_val=$("#default_sourceId").val();
						var flag =0;
						$.each(data,function(i){
							self.options[i+1] = new Option(data[i], data[i]);
							if(default_val==data[i]) {										 
								self.options[i+1].selected=true;
								$("#sourceId").attr('value',default_val);	
								flag =1;																				
							} 
						}); 
						if(flag ==0){
							$("#sourceId").attr('value','');
						}
						$(".sourceId-con").show();
						$(".sourceId-con-loading").hide();	
				 } 
			 });
		}	
	})
	if($.trim($("#source").val())!=''){
		$("#select").change();
	}
})
<!-- 更新渠道时，更新sourceId  end-->

</script>
</body>
</html>